home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
001-025
/
scopedisk4
/
patch
/
dfindone.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-18
|
731b
|
33 lines
#ifdef AMIGA
#include <dos.h>
#include <exec/memory.h>
#include <proto/exec.h>
#include <proto/dos.h>
/* Behaves almost like the Lattice dfind function, but dfindOne will not
* keep a lock.
*/
int dfindOne(info, name, attr)
struct FILEINFO *info;
char *name;
int attr;
{
BPTR lock;
struct FILEINFO *tmpInfo;
int retVal;
if(!(lock = Lock(name, ACCESS_READ)))
return(-1);
tmpInfo = (struct FILEINFO *) AllocMem(sizeof(*tmpInfo), MEMF_CLEAR);
if(retVal = Examine(lock, tmpInfo))
movmem((char *) tmpInfo, (char *) info, sizeof(*tmpInfo));
FreeMem((char *) tmpInfo, sizeof(*tmpInfo));
UnLock(lock);
if(retVal && (attr || info->fib_DirEntryType < 0))
return(0);
else
return(-1);
}
#endif